package test04.sync.test07.sisuo.a;

/**
 * @Author zqx
 * @Date 2024-03-21
 */
public class TwoThread extends Thread{
    /**
     * 锁对象
     */

    public static final Object twoLock = new Object();

    @Override
    public void run() {
        synchronized (twoLock) {
            System.out.println("TwoThread-获得了twoLock这把锁，做一些相关的处理...");
            // t2 ... twoLock - 需要 oneLock - 但 t2 无法释放 twoLock
            synchronized (OneThread.oneLock) {
                System.out.println("TwoThread-获得了oneLock这把锁，做一些相关的处理...");
            }
        }
    }
}
